package com.ebt.m.policy;

import android.os.Bundle;

import com.ebt.m.R;
import com.ebt.m.activity.BaseToolBarActivity;
import com.ebt.m.policy.bean.EventFinishAct;
import com.ebt.m.data.rxModel.apibean.PolicyProposal;
import com.ebt.m.data.rxModel.apibean.PolicyProposalItem;
import com.ebt.m.policy.view.PolicyCustomerProposalListView;

import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * @author Damon.Han
 */
public class ActCustomerProposals extends BaseToolBarActivity {
    @BindView(R.id.pclistView)
    PolicyCustomerProposalListView pclistView;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.layout_customer_proposal_list);
        ButterKnife.bind(this);
        EventBus.getDefault().register(this);
    }

    @Override
    protected void init() {
        super.init();
        PolicyProposal title = (PolicyProposal) getIntent().getSerializableExtra("data");
        if (title == null) {
            return;
        }
        List<PolicyProposalItem> list = title.proposalItems;
        pclistView.update(list);
        setTitle(title.name + "的计划书");
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        EventBus.getDefault().unregister(this);
    }

    @Subscribe
    public void onEvent(EventFinishAct event) {
        finish();
    }
}
